package com.example.alldemo.bean;

import com.example.alldemo.interceptor.InterceptorConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class InterceptorBean {

    @Autowired
    private InterceptorConfig interceptorConfig;

    @Bean
    public WebMvcConfigurer webMvcConfigurer() {
        return new WebMvcConfigurer() {
            @Override
            public void addInterceptors(InterceptorRegistry registry) {
//                //拦截路径
//                registry.addInterceptor(interceptorConfig).addPathPatterns("/getall");
//                        .excludePathPatterns("/err")
//                        .excludePathPatterns("/getinfo")
//                        .excludePathPatterns("swagger-ui.html");
            }
        };
    }

}
